﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 战棋模拟器
{
    class 火焰传令官:Minion
    {//目前还没有定论，根据自己以及一些网络资源的测试结果推测，超杀类都是先计算超杀了哪些单位再一起结算。
        public 火焰传令官():base()
        {
            Star = 4;
            Attack = 5;
            Health = 4;
            Race = race.dragon;
            damage = 3;
        }


        public override Minion NewOne()
        {
            return new 火焰传令官();
        }


        public override void Doattack(Minion m)
        {
            List<Minion> Todo = new List<Minion>();
            if (!m.Skills[3]&&m.Health<=Attack)
            {
                if (pool.board.Debug)
                {
                    Console.WriteLine("超杀{0}方第{1}位的{2}",
                        pool.direction?"下":"上",
                        m.Place,
                        m.Name);
                }
                foreach (Minion n in pool.next.places)
                {
                    if (n == null)
                        break;
                    if (n == m)
                        continue;
                    Todo.Add(n);
                    if (n.Skills[3] || n.Health >= damage)//没有超杀
                        break;
                    else if (pool.board.Debug)
                    {
                        Console.WriteLine("超杀{0}方第{1}位的{2}",
                            pool.direction ? "下" : "上",
                            n.Place,
                            n.Name);
                    }
                }
            }
            foreach(Minion n in Todo)
            {
                n.Getdamaged(damage);
                if(pool.board.Debug)
                {
                    Console.WriteLine("{0}对{1}造成了{2}点伤害", Name, n.Name, damage);
                }
                if (n.Health <= 0)
                    pool.OnDragonKill();
            }
            base.Doattack(m);
        }
    }


    class 火焰传令官_金色 : 火焰传令官
    {
        public 火焰传令官_金色() : base()
        {
            Attack *= 2;
            Health *= 2;
            damage *= 2;
        }

        public override Minion NewOne()
        {
            return new 火焰传令官_金色();
        }
    }
}
